package com.dcw.lixb.designmode.factory;

/**
 * @author lixiaobin
 * @date 2020-07-16 16:28:14
 * @desc 描述信息
 */
public class BreadFactory {
    public static final String Hamburger = "Hamburger";
    public static final String Sandwich = "Sandwich";
    public static final String HotDog = "HotDog";

    public static Bread createBread(String bread) {
        switch (bread) {
            case Hamburger:
                return new Hamburger();
            case Sandwich:
                return new Sandwich();
            case HotDog:
                return new HotDog();
            default:
                return new Bread() {
                    @Override
                    public String toString() {
                        return "This is a bread";
                    }
                };
        }
    }
}
